var inArray = require('in-array');
console.log(inArray(['a', 'b', 'c'], 'c'), myInArray(['a', 'b', 'c'], 'c'));
//=> true
 
console.log(inArray(null, 'a'), myInArray(null, 'a'));
//=> false
 
console.log(inArray(null), myInArray(null));
//=> false




/**
 * 查找数组的元素是否存在
 * 与includes/indexOf功能相似
 * @param  {[type]} arr    [description]
 * @param  {[type]} search [description]
 * @return {[type]}        [description]
 */
function myInArray(arr, search) {
	arr = arr || []
	for (var i = 0; i < arr.length; i++) {
		if(arr[i] === search) {
			return true
		}
	}
	return false ;
}